import 'package:flutter/material.dart';

class MySliverDelegate extends SliverPersistentHeaderDelegate {
  final double minHeight; // 最小高度
  final double maxHeight; // 最大高度
  final Widget child;

  MySliverDelegate({
    required this.minHeight,
    required this.maxHeight,
    required this.child
  });

  @override
  double get minExtent => minHeight;

  @override
  double get maxExtent => maxHeight;

  @override
  Widget build(BuildContext context, double strinkOffset, bool overlapsContent) {
    return child;
  }

  @override
  bool shouldRebuild(MySliverDelegate oldDelegate) {
    return true;
  }
}